<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="common/include :: header('${vo.describe}')" />
	<th:block th:include="common/include :: footer" />
</head>

<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			
			<!-- 表格搜索栏  -->			
			<div class="col-sm-12 search-collapse">
				<form id="type-form">
					<div class="select-list">
						<ul>
							<li>
								字典名称：<input type="text" name="SEARCH_LIKE_name" class="pageSearch" />
							</li>
							<li class="select-time">
								<label>创建时间： </label>
								<input type="text" class="time-input pageSearch" id="startTime" placeholder="开始时间" name="SEARCH_lg_ct" style="width:120px"/>
								<span>-</span>
								<input type="text" class="time-input pageSearch" id="endTime" placeholder="结束时间" name="SEARCH_rg_ct" style="width:120px" />
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
		   <!-- 表格工具栏  -->
	       <div class="btn-group-sm" id="toolbar" role="group">
	            <a class="btn btn-success" onclick="$.operate.add()"   >
	                <i class="fa fa-plus"></i> 新增
	            </a>
	            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"  >
		            <i class="fa fa-edit"></i> 修改
		        </a>
				<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"  >
		            <i class="fa fa-remove"></i> 删除
		        </a>
	        </div>
	        
	        <!-- 表格数据栏  -->
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
	
	<script th:inline="javascript">
		
		var editFlag = "1";
		var listFlag = "1";
		var removeFlag = "1";
		var prefix = ctx + "/${vo.tablename_camelCase}";
		$(function() {
		    var options = {
		        url: prefix + "/getList",
		        createUrl: prefix + "/toForm",
		        updateUrl: prefix + "/toForm?id={id}",
		        removeUrl: prefix + "/delete",
		        sortName: "createTime",
		        sortOrder: "desc",
		        modalName: "类型",
		        columns: [
				    {checkbox: true, align: 'center' },
				 <#if vo.columns?exists>
					<#list vo.columns as item>
					{field: '${item.columnName}',  title: '${item.columnRemark}',  align: 'center', valign: 'middle' },
					</#list>
				  </#if>
					{
			            title: '操作',
			            align: 'center',
			            formatter: function(value, row, index) {
			                var actions = [];
			                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
			                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
			                return actions.join('');
			            }
			        } 
				]
		    };
		    $.table.init(options);
		});
		 
	</script>
</body>
</html>